package com.my.relation;
/**
 * 单向/双向关联关系,new是否死循环
 */
public class Test {

	public static void main(String[] args) {
		//Father f = new Father();这样在成员变量中直接new的话会造成死循环
		FatherNew f = new FatherNew();
		SonNew s = new SonNew();
		f.setName("dad");
		s.setName("honey");
		f.setSon(s);
		s.setFather(f);
		
		f.giveGift();
		s.getGift();
	}

}
